> ## Documentation Index
> Fetch the complete documentation index at: https://developers.resistant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create tenant application

> Creates application for a tenant



## OpenAPI

````yaml /tm_openapi.json post /tenants/{tenant_id}/applications
openapi: 3.0.1
info:
  title: Resistant Documents organization Tenants API - prod
  version: 0.0.1
  description: >-

    Resistant Documents provides this API to programmatically interact with its
    organization tenant management.

    Interaction with the API can be divided into three phases:


    1. organization access provisioning and its configuration. This is managed
    by the Resistant AI team and credentials for API access are provided.

    2. Managing tenants within organization - creation, deletion and listing.

    3. Configuration of an api access for provisioned tenant.
servers:
  - url: https://{environment}.resistant.ai/v0
    description: Tenant Management API
    variables:
      environment:
        default: api.tenants
        enum:
          - api.tenants
          - api.tenants.testing
security: []
paths:
  /tenants/{tenant_id}/applications:
    post:
      summary: Create tenant application
      description: Creates application for a tenant
      operationId: createTenantApplication
      parameters:
        - in: path
          name: tenant_id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TenantApplicationCreateRequest'
      responses:
        '201':
          description: Tenant application created
          headers:
            Location:
              description: URL of the created tenant application
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenantApplicationResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - OAuth2:
            - tenants.applications.write
components:
  schemas:
    TenantApplicationCreateRequest:
      title: TenantApplicationCreateRequest
      type: object
      properties:
        cell:
          $ref: '#/components/schemas/CellName'
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/DocumentsScope'
        auth_method:
          $ref: '#/components/schemas/Authentication'
      required:
        - cell
        - scopes
        - auth_method
    TenantApplicationResponse:
      title: TenantApplicationResponse
      type: object
      properties:
        id:
          title: Id
          type: string
        client_id:
          title: Client Id
          type: string
        auth_server:
          title: Auth_server
          type: string
          description: Auth server url
        cell:
          $ref: '#/components/schemas/CellName'
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/DocumentsScope'
        credentials:
          $ref: '#/components/schemas/Credentials'
        _links:
          title: Links
          type: object
          properties:
            token_url:
              type: string
          additionalProperties: true
      required:
        - id
        - cell
        - scopes
        - client_id
        - auth_server
    CellName:
      title: CellName
      description: An enumeration.
      enum:
        - eu-1
        - us-1
        - ap-2
        - ap-3
        - ca-1
      type: string
    DocumentsScope:
      title: DocumentsScope
      description: An enumeration.
      enum:
        - documents.submissions.read
        - documents.submissions.write
      type: string
    Authentication:
      title: Authentication
      discriminator:
        propertyName: type
        mapping:
          RSA:
            $ref: '#/components/schemas/RSAAuthentication'
          EC:
            $ref: '#/components/schemas/ECAuthentication'
          CLIENT_SECRET:
            $ref: '#/components/schemas/ClientSecretAuthentication'
      oneOf:
        - $ref: '#/components/schemas/RSAAuthentication'
        - $ref: '#/components/schemas/ECAuthentication'
        - $ref: '#/components/schemas/ClientSecretAuthentication'
    Credentials:
      title: Credentials
      description: Credentials are returned only once for newly created applications
      discriminator:
        propertyName: type
        mapping:
          RSA:
            $ref: '#/components/schemas/RSACredentials'
          EC:
            $ref: '#/components/schemas/ECCredentials'
          CLIENT_SECRET:
            $ref: '#/components/schemas/ClientSecretCredentials'
      oneOf:
        - $ref: '#/components/schemas/RSACredentials'
        - $ref: '#/components/schemas/ECCredentials'
        - $ref: '#/components/schemas/ClientSecretCredentials'
    Error:
      title: Error
      type: object
      properties:
        message:
          title: Error message
          description: Detailed error message
          minLength: 0
          maxLength: 512
          type: string
      required:
        - message
    RSAAuthentication:
      title: RSAAuthentication
      type: object
      properties:
        type:
          title: Type
          type: string
        alg:
          title: Alg
          type: string
          description: Signing algorithm
          enum:
            - RS256
        kid:
          title: Kid
          type: string
          description: The unique identifier of the key.
        e:
          title: e
          type: integer
          description: The key exponent of a RSA key.
          enum:
            - 65537
        'n':
          title: 'n'
          type: integer
          description: >-
            The modulus of the RSA key. Key size needs to be bigger then 2048
            bits
      required:
        - type
        - alg
        - kid
        - e
        - 'n'
    ECAuthentication:
      title: ECAuthentication
      type: object
      properties:
        type:
          title: Type
          type: string
        alg:
          title: Alg
          type: string
          description: Signing algorithm
          enum:
            - ES256
        kid:
          title: Kid
          type: string
          description: The unique identifier of the key.
        x:
          title: x
          type: integer
          description: The public x coordinate for the elliptic curve point.
        'y':
          title: 'y'
          type: integer
          description: The public y coordinate for the elliptic curve point.
      required:
        - type
        - alg
        - kid
        - x
        - 'y'
    ClientSecretAuthentication:
      title: ClientSecretAuthentication
      type: object
      properties:
        type:
          title: Type
          type: string
      required:
        - type
    RSACredentials:
      title: RSACredentials
      type: object
      properties:
        type:
          title: Type
          type: string
        alg:
          title: Alg
          type: string
          description: Signing algorithm
          enum:
            - RS256
        kid:
          title: Kid
          type: string
          description: The unique identifier of the key.
      required:
        - type
        - alg
        - kid
    ECCredentials:
      title: ECCredentials
      type: object
      properties:
        type:
          title: Type
          type: string
        alg:
          title: Alg
          type: string
          description: Signing algorithm
          enum:
            - ES256
        kid:
          title: Kid
          type: string
          description: The unique identifier of the key.
      required:
        - type
        - alg
        - kid
    ClientSecretCredentials:
      title: ClientSecretCredentials
      type: object
      properties:
        type:
          title: Type
          type: string
        client_secret:
          title: Client Secret
          type: string
          description: Client credentials secret
      required:
        - type
        - client_secret
  responses:
    BadRequest:
      description: Bad request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing valid authentication credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Access to the requested resource is forbidden.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnsupportedMediaType:
      description: Unsupported media type.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Request quota was exceeded
  securitySchemes:
    OAuth2:
      type: oauth2
      description: >
        [JWT with private
        key](https://developer.okta.com/docs/api/openapi/okta-oauth/guides/client-auth/#jwt-with-private-key).

        [Java
        example](https://developer.okta.com/docs/guides/build-self-signed-jwt/java/main/#build-a-jwt-with-a-private-key)
         Please note that Token URL is specific for a given environment. Correct URL is in the corresponding environment documentation.
      flows:
        clientCredentials:
          tokenUrl: https://eu.id.resistant.ai/oauth2/aus17c172cLOCWEyk417/v1/token
          scopes:
            tenants.read: Read tenant configurations within the organization
            tenants.write: Manage and configure tenants within the organization
            tenants.applications.read: Read tenant applications
            tenants.applications.write: Manage tenant applications
            organization.read: Read organization configuration

````