# Authorize a third-party app (/docs/api/access/auth_code_create)

Consent step of Sign in with GridRouter (OAuth PKCE, S256): a signed-in member approves an app and gets a one-time code (10 minutes) to redirect back with.

`POST /v1/auth/codes`

```json
{
  "operationId": "auth_code_create",
  "summary": "Authorize a third-party app",
  "description": "Consent step of Sign in with GridRouter (OAuth PKCE, S256): a signed-in member approves an app and gets a one-time code (10 minutes) to redirect back with.",
  "tags": [
    "auth"
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "callback_url": {
              "type": "string",
              "maxLength": 2000
            },
            "code_challenge": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{43}$"
            },
            "code_challenge_method": {
              "type": "string",
              "enum": [
                "S256"
              ],
              "default": "S256"
            },
            "key_label": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "app_name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "limit_micro": {
              "type": "integer",
              "minimum": 0
            },
            "limit_reset": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month",
                "never"
              ]
            },
            "expires_in_days": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365
            }
          },
          "required": [
            "code_challenge"
          ]
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string",
                "enum": [
                  "auth_code"
                ]
              },
              "code": {
                "type": "string"
              },
              "redirect_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "object",
              "code",
              "redirect_url",
              "expires_at"
            ]
          }
        }
      }
    },
    "default": {
      "description": "Error",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "invalid_request",
                      "unauthorized",
                      "insufficient_balance",
                      "max_cost_exceeded",
                      "scope_denied",
                      "budget_blocked",
                      "not_found",
                      "idempotency_mismatch",
                      "invalid_meta",
                      "rate_limited",
                      "upstream_error",
                      "response_buffer_limit",
                      "provider_capacity_unavailable",
                      "grid_saturated",
                      "upstream_timeout",
                      "conflict",
                      "internal_error",
                      "account_frozen",
                      "strict_filters",
                      "plan_limit_reached",
                      "validation_failed",
                      "deadline_exceeded",
                      "cancelled"
                    ]
                  },
                  "message": {
                    "type": "string"
                  },
                  "request_id": {
                    "type": "string"
                  },
                  "call_id": {
                    "type": "string"
                  },
                  "retry_after_ms": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "details": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  }
}
```
