# OAuth API reference

Source: `@socra/oauth-api@0.0.6` (OauthContract).

OAuth client registration, branding, and token services.

## API surface

Base URL: `https://oauth.socra.cloud`

## OAuth configs

Project-level OAuth branding, audience, and publishing configuration.

### Resource schema

- `project_id` custom, required
- `application_name` string (min length: 1; max length: 120), required
- `support_email` string | null, required
- `logo_uri` string | null, required
- `homepage_uri` string | null, required
- `privacy_policy_uri` string | null, required
- `terms_of_service_uri` string | null, required
- `authorized_domains` string[], required
- `audience` "internal" | "external", required
- `publishing_status` "testing" | "production", required
- `created_at` custom, required
- `updated_at` custom, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "project_id": {},
    "application_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "support_email": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 320,
          "format": "email",
          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "homepage_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "privacy_policy_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "terms_of_service_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "authorized_domains": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 253
      }
    },
    "audience": {
      "type": "string",
      "enum": [
        "internal",
        "external"
      ]
    },
    "publishing_status": {
      "type": "string",
      "enum": [
        "testing",
        "production"
      ]
    },
    "created_at": {},
    "updated_at": {}
  },
  "required": [
    "project_id",
    "application_name",
    "support_email",
    "logo_uri",
    "homepage_uri",
    "privacy_policy_uri",
    "terms_of_service_uri",
    "authorized_domains",
    "audience",
    "publishing_status",
    "created_at",
    "updated_at"
  ],
  "additionalProperties": false
}
```

### Get OAuth config

`GET /v1/projects/{project_id}/config`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Response

- `project_id` custom, required
- `application_name` string (min length: 1; max length: 120), required
- `support_email` string | null, required
- `logo_uri` string | null, required
- `homepage_uri` string | null, required
- `privacy_policy_uri` string | null, required
- `terms_of_service_uri` string | null, required
- `authorized_domains` string[], required
- `audience` "internal" | "external", required
- `publishing_status` "testing" | "production", required
- `created_at` custom, required
- `updated_at` custom, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "project_id": {},
    "application_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "support_email": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 320,
          "format": "email",
          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "homepage_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "privacy_policy_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "terms_of_service_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "authorized_domains": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 253
      }
    },
    "audience": {
      "type": "string",
      "enum": [
        "internal",
        "external"
      ]
    },
    "publishing_status": {
      "type": "string",
      "enum": [
        "testing",
        "production"
      ]
    },
    "created_at": {},
    "updated_at": {}
  },
  "required": [
    "project_id",
    "application_name",
    "support_email",
    "logo_uri",
    "homepage_uri",
    "privacy_policy_uri",
    "terms_of_service_uri",
    "authorized_domains",
    "audience",
    "publishing_status",
    "created_at",
    "updated_at"
  ],
  "additionalProperties": false
}
```

### Update OAuth config

`PATCH /v1/projects/{project_id}/config`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Request body

- `application_name` string (min length: 1; max length: 120), optional
- `support_email` string | null, optional
- `logo_uri` string | null, optional
- `homepage_uri` string | null, optional
- `privacy_policy_uri` string | null, optional
- `terms_of_service_uri` string | null, optional
- `authorized_domains` string[], optional
- `audience` "internal" | "external", optional

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "application_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "support_email": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 320,
          "format": "email",
          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "homepage_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "privacy_policy_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "terms_of_service_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "authorized_domains": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 253
      }
    },
    "audience": {
      "type": "string",
      "enum": [
        "internal",
        "external"
      ]
    }
  }
}
```

#### Response

- `project_id` custom, required
- `application_name` string (min length: 1; max length: 120), required
- `support_email` string | null, required
- `logo_uri` string | null, required
- `homepage_uri` string | null, required
- `privacy_policy_uri` string | null, required
- `terms_of_service_uri` string | null, required
- `authorized_domains` string[], required
- `audience` "internal" | "external", required
- `publishing_status` "testing" | "production", required
- `created_at` custom, required
- `updated_at` custom, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "project_id": {},
    "application_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "support_email": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 320,
          "format": "email",
          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "homepage_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "privacy_policy_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "terms_of_service_uri": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2048,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "authorized_domains": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 253
      }
    },
    "audience": {
      "type": "string",
      "enum": [
        "internal",
        "external"
      ]
    },
    "publishing_status": {
      "type": "string",
      "enum": [
        "testing",
        "production"
      ]
    },
    "created_at": {},
    "updated_at": {}
  },
  "required": [
    "project_id",
    "application_name",
    "support_email",
    "logo_uri",
    "homepage_uri",
    "privacy_policy_uri",
    "terms_of_service_uri",
    "authorized_domains",
    "audience",
    "publishing_status",
    "created_at",
    "updated_at"
  ],
  "additionalProperties": false
}
```

## OAuth clients

A runtime-specific OAuth client registration owned by a project config.

### Resource schema

- `id` custom, required
- `project_id` custom, required
- `name` string (min length: 1; max length: 120), required
- `type` "web" | "spa" | "native", required
- `redirect_uris` string[] (max items: 100), required
- `javascript_origins` string[] (max items: 100), required
- `status` "active" | "suspended", required
- `created_at` custom, required
- `updated_at` custom, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "project_id": {},
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "type": {
      "type": "string",
      "enum": [
        "web",
        "spa",
        "native"
      ]
    },
    "redirect_uris": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "javascript_origins": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "suspended"
      ]
    },
    "created_at": {},
    "updated_at": {}
  },
  "required": [
    "id",
    "project_id",
    "name",
    "type",
    "redirect_uris",
    "javascript_origins",
    "status",
    "created_at",
    "updated_at"
  ],
  "additionalProperties": false
}
```

### Create OAuth client

`POST /v1/projects/{project_id}/clients`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Request body

- `name` string (min length: 1; max length: 120), required
- `type` "web" | "spa" | "native", required
- `redirect_uris` string[] (default: []; max items: 100), optional
- `javascript_origins` string[] (default: []; max items: 100), optional

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "type": {
      "type": "string",
      "enum": [
        "web",
        "spa",
        "native"
      ]
    },
    "redirect_uris": {
      "default": [],
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "javascript_origins": {
      "default": [],
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    }
  },
  "required": [
    "name",
    "type"
  ]
}
```

#### Response

- `id` custom, required
- `project_id` custom, required
- `name` string (min length: 1; max length: 120), required
- `type` "web" | "spa" | "native", required
- `redirect_uris` string[] (max items: 100), required
- `javascript_origins` string[] (max items: 100), required
- `status` "active" | "suspended", required
- `created_at` custom, required
- `updated_at` custom, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "project_id": {},
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "type": {
      "type": "string",
      "enum": [
        "web",
        "spa",
        "native"
      ]
    },
    "redirect_uris": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "javascript_origins": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "suspended"
      ]
    },
    "created_at": {},
    "updated_at": {}
  },
  "required": [
    "id",
    "project_id",
    "name",
    "type",
    "redirect_uris",
    "javascript_origins",
    "status",
    "created_at",
    "updated_at"
  ],
  "additionalProperties": false
}
```

### List OAuth clients

`GET /v1/projects/{project_id}/clients`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Query parameters

- `limit` integer (min: 1; max: 100), optional
- `after` string, optional

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "after": {
      "type": "string"
    }
  }
}
```

#### Response

- `data` object[], required
  - `id` custom, required
  - `project_id` custom, required
  - `name` string (min length: 1; max length: 120), required
  - `type` "web" | "spa" | "native", required
  - `redirect_uris` string[] (max items: 100), required
  - `javascript_origins` string[] (max items: 100), required
  - `status` "active" | "suspended", required
  - `created_at` custom, required
  - `updated_at` custom, required
- `has_more` boolean, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {},
          "project_id": {},
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "type": {
            "type": "string",
            "enum": [
              "web",
              "spa",
              "native"
            ]
          },
          "redirect_uris": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri"
            }
          },
          "javascript_origins": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended"
            ]
          },
          "created_at": {},
          "updated_at": {}
        },
        "required": [
          "id",
          "project_id",
          "name",
          "type",
          "redirect_uris",
          "javascript_origins",
          "status",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      }
    },
    "has_more": {
      "type": "boolean"
    }
  },
  "required": [
    "data",
    "has_more"
  ],
  "additionalProperties": false
}
```

### Get OAuth client

`GET /v1/projects/{project_id}/clients/{client_id}`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```

- `client_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Response

- `id` custom, required
- `project_id` custom, required
- `name` string (min length: 1; max length: 120), required
- `type` "web" | "spa" | "native", required
- `redirect_uris` string[] (max items: 100), required
- `javascript_origins` string[] (max items: 100), required
- `status` "active" | "suspended", required
- `created_at` custom, required
- `updated_at` custom, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "project_id": {},
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "type": {
      "type": "string",
      "enum": [
        "web",
        "spa",
        "native"
      ]
    },
    "redirect_uris": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "javascript_origins": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "suspended"
      ]
    },
    "created_at": {},
    "updated_at": {}
  },
  "required": [
    "id",
    "project_id",
    "name",
    "type",
    "redirect_uris",
    "javascript_origins",
    "status",
    "created_at",
    "updated_at"
  ],
  "additionalProperties": false
}
```

### Update OAuth client

`PATCH /v1/projects/{project_id}/clients/{client_id}`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```

- `client_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Request body

- `name` string (min length: 1; max length: 120), optional
- `redirect_uris` string[] (max items: 100), optional
- `javascript_origins` string[] (max items: 100), optional
- `status` "active" | "suspended", optional

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "redirect_uris": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "javascript_origins": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "suspended"
      ]
    }
  }
}
```

#### Response

- `id` custom, required
- `project_id` custom, required
- `name` string (min length: 1; max length: 120), required
- `type` "web" | "spa" | "native", required
- `redirect_uris` string[] (max items: 100), required
- `javascript_origins` string[] (max items: 100), required
- `status` "active" | "suspended", required
- `created_at` custom, required
- `updated_at` custom, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "project_id": {},
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "type": {
      "type": "string",
      "enum": [
        "web",
        "spa",
        "native"
      ]
    },
    "redirect_uris": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "javascript_origins": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "suspended"
      ]
    },
    "created_at": {},
    "updated_at": {}
  },
  "required": [
    "id",
    "project_id",
    "name",
    "type",
    "redirect_uris",
    "javascript_origins",
    "status",
    "created_at",
    "updated_at"
  ],
  "additionalProperties": false
}
```

### Delete OAuth client

`DELETE /v1/projects/{project_id}/clients/{client_id}`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```

- `client_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Response

No response body.

## Client secrets

A hashed OAuth client credential. Plaintext is returned only when created.

### Resource schema

- `id` custom, required
- `client_id` custom, required
- `secret_hint` string, required
- `created_at` custom, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "client_id": {},
    "secret_hint": {
      "type": "string"
    },
    "created_at": {}
  },
  "required": [
    "id",
    "client_id",
    "secret_hint",
    "created_at"
  ],
  "additionalProperties": false
}
```

### Create client secret

`POST /v1/projects/{project_id}/clients/{client_id}/secrets`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```

- `client_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Response

- `id` custom, required
- `client_id` custom, required
- `secret_hint` string, required
- `created_at` custom, required
- `secret` string, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "client_id": {},
    "secret_hint": {
      "type": "string"
    },
    "created_at": {},
    "secret": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "client_id",
    "secret_hint",
    "created_at",
    "secret"
  ],
  "additionalProperties": false
}
```

### List client secrets

`GET /v1/projects/{project_id}/clients/{client_id}/secrets`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```

- `client_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Response

- `data` object[], required
  - `id` custom, required
  - `client_id` custom, required
  - `secret_hint` string, required
  - `created_at` custom, required
- `has_more` boolean, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {},
          "client_id": {},
          "secret_hint": {
            "type": "string"
          },
          "created_at": {}
        },
        "required": [
          "id",
          "client_id",
          "secret_hint",
          "created_at"
        ],
        "additionalProperties": false
      }
    },
    "has_more": {
      "type": "boolean"
    }
  },
  "required": [
    "data",
    "has_more"
  ],
  "additionalProperties": false
}
```

### Delete client secret

`DELETE /v1/projects/{project_id}/clients/{client_id}/secrets/{secret_id}`

#### Path parameters

- `project_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```

- `client_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```

- `secret_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Response

No response body.

## Installations

Account-owner consent for a project to act as its own local principal.

### Resource schema

- `id` custom, required
- `project_id` custom, required
- `account_id` string, required
- `principal_id` string | null, required
- `application_name` string, required
- `scopes` string[], required
- `status` "pending" | "active" | "revoked", required
- `authorized_by_id` string, required
- `authorized_at` custom, required
- `created_at` custom, required
- `revoked_at` custom | null, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "project_id": {},
    "account_id": {
      "type": "string"
    },
    "principal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "application_name": {
      "type": "string"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "active",
        "revoked"
      ]
    },
    "authorized_by_id": {
      "type": "string"
    },
    "authorized_at": {},
    "created_at": {},
    "revoked_at": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "project_id",
    "account_id",
    "principal_id",
    "application_name",
    "scopes",
    "status",
    "authorized_by_id",
    "authorized_at",
    "created_at",
    "revoked_at"
  ],
  "additionalProperties": false
}
```

### Consent to an installation

`POST /v1/installations`

#### Request body

- `project_id` custom, required
- `scopes` string[] (default: []; max items: 100), optional

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "project_id": {},
    "scopes": {
      "default": [],
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 512,
        "pattern": "^[\\x21\\x23-\\x5B\\x5D-\\x7E]+$"
      }
    }
  },
  "required": [
    "project_id"
  ]
}
```

#### Response

- `id` custom, required
- `project_id` custom, required
- `account_id` string, required
- `principal_id` string | null, required
- `application_name` string, required
- `scopes` string[], required
- `status` "pending" | "active" | "revoked", required
- `authorized_by_id` string, required
- `authorized_at` custom, required
- `created_at` custom, required
- `revoked_at` custom | null, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "project_id": {},
    "account_id": {
      "type": "string"
    },
    "principal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "application_name": {
      "type": "string"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "active",
        "revoked"
      ]
    },
    "authorized_by_id": {
      "type": "string"
    },
    "authorized_at": {},
    "created_at": {},
    "revoked_at": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "project_id",
    "account_id",
    "principal_id",
    "application_name",
    "scopes",
    "status",
    "authorized_by_id",
    "authorized_at",
    "created_at",
    "revoked_at"
  ],
  "additionalProperties": false
}
```

### Get installation

`GET /v1/installations/{installation_id}`

#### Path parameters

- `installation_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Response

- `id` custom, required
- `project_id` custom, required
- `account_id` string, required
- `principal_id` string | null, required
- `application_name` string, required
- `scopes` string[], required
- `status` "pending" | "active" | "revoked", required
- `authorized_by_id` string, required
- `authorized_at` custom, required
- `created_at` custom, required
- `revoked_at` custom | null, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {},
    "project_id": {},
    "account_id": {
      "type": "string"
    },
    "principal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "application_name": {
      "type": "string"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "active",
        "revoked"
      ]
    },
    "authorized_by_id": {
      "type": "string"
    },
    "authorized_at": {},
    "created_at": {},
    "revoked_at": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "project_id",
    "account_id",
    "principal_id",
    "application_name",
    "scopes",
    "status",
    "authorized_by_id",
    "authorized_at",
    "created_at",
    "revoked_at"
  ],
  "additionalProperties": false
}
```

### List installations

`GET /v1/installations`

#### Query parameters

- `limit` integer (min: 1; max: 100), optional
- `after` string, optional

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "after": {
      "type": "string"
    }
  }
}
```

#### Response

- `data` object[], required
  - `id` custom, required
  - `project_id` custom, required
  - `account_id` string, required
  - `principal_id` string | null, required
  - `application_name` string, required
  - `scopes` string[], required
  - `status` "pending" | "active" | "revoked", required
  - `authorized_by_id` string, required
  - `authorized_at` custom, required
  - `created_at` custom, required
  - `revoked_at` custom | null, required
- `has_more` boolean, required

JSON Schema:

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {},
          "project_id": {},
          "account_id": {
            "type": "string"
          },
          "principal_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "application_name": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "revoked"
            ]
          },
          "authorized_by_id": {
            "type": "string"
          },
          "authorized_at": {},
          "created_at": {},
          "revoked_at": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "project_id",
          "account_id",
          "principal_id",
          "application_name",
          "scopes",
          "status",
          "authorized_by_id",
          "authorized_at",
          "created_at",
          "revoked_at"
        ],
        "additionalProperties": false
      }
    },
    "has_more": {
      "type": "boolean"
    }
  },
  "required": [
    "data",
    "has_more"
  ],
  "additionalProperties": false
}
```

### Revoke installation

`DELETE /v1/installations/{installation_id}`

#### Path parameters

- `installation_id` custom, required

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```


#### Response

No response body.

---

Company: Socra — Multiply Your Judgment
Canonical URL: https://cloud.socra.com/docs/oauth/reference/api
