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

# Create an Application

> Registers an application and issues its credentials.

⚠️ The response carries the `clientSecret` IN FULL, and no other Identity API response returns it. Store it when you receive it; a later read of the same application does not show it again. Losing it means deleting the application and creating another.

Send `partnerId` to bind the credential to one of your customers: the application is then confined to that partner's permissions and scope, and reaches only the intersection of the two.

Failures:
- `400` — a required member is missing or malformed.
- `404 IDE-1046` — `partnerId` names a partner that does not exist in your organization.
- `400 IDE-0007` — `nature` holds any value other than `bancarizador`, or is sent with `partnerId`; `fields.nature` names it. Nothing was created.
- `400 IDE-1063` — multi-tenant only: the request sends `source`. Service credentials are issued by Lerian, never through this route; nothing was created. Remove `source` and retry.
- `400 IDE-1064` — single-tenant only: the request sends `source`. Service credentials are issued through `POST /v1/applications/service-credentials`; nothing was created. Remove `source` and retry.
- `503 IDE-0064` — another application for the same product is being created in your organization at the same moment. Creates for one product are applied one at a time, so this request waits up to about 10 seconds for its turn and answers this only if the other create is still running. Nothing about the request was wrong and nothing was created; retry it.
- `503 IDE-0065` — the service that coordinates concurrent creates did not answer within that wait. Nothing was created; retry it.
- `503 IDE-0066` — the identity provider is unavailable (unreachable, too slow to answer, or failing). Nothing about the request was wrong; retry it later.



## OpenAPI

````yaml /pt/openapi/v3-current/AM-identity.yaml post /v1/applications
openapi: 3.1.0
info:
  contact:
    name: Lerian Studio
    url: https://lerian.studio
  description: OpenAPI 3.1 surface for the Access Manager identity component.
  license:
    name: Lerian Studio General License
  title: Access Manager Identity API
  version: v1
servers:
  - url: https://identity.sandbox.lerian.net
security: []
tags:
  - description: >-
      M2M-only: each plugin declares its own permissions, roles and M2M
      contract, and the server reconciles them.
    name: Declarations
  - description: >-
      A tenant administrator's customers. Each partner holds what its
      credentials may DO (permissions, per product) and WHERE they may do it
      (scope, per product and dimension); an M2M application attached to one is
      confined to that intersection. Administrator-only: authorized on the
      "partners" resource, and every route resolves the owning organization from
      the caller's token.
    name: Partners
paths:
  /v1/applications:
    post:
      tags:
        - Applications
      summary: Create an Application
      description: >-
        Registers an application and issues its credentials.


        ⚠️ The response carries the `clientSecret` IN FULL, and no other
        Identity API response returns it. Store it when you receive it; a later
        read of the same application does not show it again. Losing it means
        deleting the application and creating another.


        Send `partnerId` to bind the credential to one of your customers: the
        application is then confined to that partner's permissions and scope,
        and reaches only the intersection of the two.


        Failures:

        - `400` — a required member is missing or malformed.

        - `404 IDE-1046` — `partnerId` names a partner that does not exist in
        your organization.

        - `400 IDE-0007` — `nature` holds any value other than `bancarizador`,
        or is sent with `partnerId`; `fields.nature` names it. Nothing was
        created.

        - `400 IDE-1063` — multi-tenant only: the request sends `source`.
        Service credentials are issued by Lerian, never through this route;
        nothing was created. Remove `source` and retry.

        - `400 IDE-1064` — single-tenant only: the request sends `source`.
        Service credentials are issued through `POST
        /v1/applications/service-credentials`; nothing was created. Remove
        `source` and retry.

        - `503 IDE-0064` — another application for the same product is being
        created in your organization at the same moment. Creates for one product
        are applied one at a time, so this request waits up to about 10 seconds
        for its turn and answers this only if the other create is still running.
        Nothing about the request was wrong and nothing was created; retry it.

        - `503 IDE-0065` — the service that coordinates concurrent creates did
        not answer within that wait. Nothing was created; retry it.

        - `503 IDE-0066` — the identity provider is unavailable (unreachable,
        too slow to answer, or failing). Nothing about the request was wrong;
        retry it later.
      operationId: createApplication
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplicationInput'
              description: The application to create.
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationResponse'
          description: Created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
          description: Not Found
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
          description: Service Unavailable
      security:
        - BearerAuth: []
components:
  schemas:
    ApplicationInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Identity Used By BR Sisbajud
          type: string
        name:
          examples:
            - midaz
          type: string
        nature:
          description: >-
            Optional. bancarizador, the only accepted value, puts the top-level
            claim nature=bancarizador, which the consignado gateway requires, on
            every token this credential issues; it cannot be combined with
            partnerId, an empty string is treated as absent, and any other value
            is refused with 400.
          examples:
            - ''
          type: string
        partnerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        source:
          description: >-
            Refused in both modes: multi-tenant answers 400 IDE-1063,
            single-tenant answers 400 IDE-1064 (service credentials are issued
            through POST /v1/applications/service-credentials).
          type: string
        target:
          examples:
            - plugin-identity
          type: string
      required:
        - description
      type: object
    ApplicationResponse:
      additionalProperties: false
      properties:
        clientId:
          type: string
        clientSecret:
          description: >-
            Returned only by the create call. Absent from every Identity API
            read.
          type: string
        createdAt:
          examples:
            - '2021-09-01T00:00:00Z'
          type: string
        description:
          examples:
            - Midaz Used By Application X
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        name:
          examples:
            - Midaz
          type: string
        partnerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
      type: object
    HTTPError:
      additionalProperties: false
      properties:
        code:
          type: string
        entityType:
          type: string
        err: {}
        message:
          type: string
        title:
          type: string
      type: object
    Detail:
      additionalProperties: true
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.