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

# Upsert an application's resources and permissions

> Replaces the application's access structure by upserting its resources and their permissions in a single call.



## OpenAPI

````yaml PUT /api/v1/applications/{application_id}/structure
openapi: 3.0.0
info:
  description: REST API for AccessOwl third-party integrations
  title: AccessOwl API
  version: 1.0.0
servers:
  - url: https://api.accessowl.com
    variables: {}
security:
  - bearer: []
tags: []
paths:
  /api/v1/applications/{application_id}/structure:
    put:
      tags:
        - applications
      summary: Upsert an application's resources and permissions
      description: >-
        Replaces the application's access structure by upserting its resources
        and their permissions in a single call.
      operationId: AccessOwlApi.ApplicationController.update_structure
      parameters:
        - description: >-
            Optional key (1–255 chars) for safely retrying a request. Reusing
            the same key for the same request returns `409 Conflict` and is not
            processed again — this confirms the request was already received.
            Keys are retained for 14 days.
          in: header
          name: Idempotency-Key
          required: false
          schema:
            maxLength: 255
            minLength: 1
            type: string
        - description: ''
          in: path
          name: application_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateStructure'
        description: Update structure parameters
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Application'
          description: Application
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Stale entry
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Validation error
      callbacks: {}
components:
  schemas:
    UpdateStructure:
      description: >-
        Upsert resources and permissions for an application. This is a partial
        upsert, not a full overwrite: omitted items are left untouched. To
        remove an item, send it with its `id` and `delete: true` (this applies
        to both resources and their nested permissions).
      properties:
        lock_version:
          description: Optimistic lock version. Optional; if stale, returns 409.
          type: integer
        resources:
          description: Resources to upsert.
          items:
            $ref: '#/components/schemas/ResourceInput'
          type: array
      title: UpdateStructure
      type: object
    Application:
      description: An application in the organization
      example:
        admin_user_ids:
          - 7488a646-e31f-11e4-aace-600308960665
        auth_method: okta
        data_location: EU
        description: Team communication platform
        id: 7488a646-e31f-11e4-aace-600308960662
        inserted_at: '2023-01-01T00:00:00Z'
        last_vendor_review_at: '2026-01-15'
        mfa_activated: true
        notes: Reviewed in Q4
        owner_user_id: 7488a646-e31f-11e4-aace-600308960663
        processed_data_types:
          - customer_data
        provisioning_type: automatic
        risk_level: medium
        status: requestable
        tags:
          - id: 7488a646-e31f-11e4-aace-600308960666
            title: Communication
        title: Slack
        updated_at: '2023-01-01T00:00:00Z'
        url: https://slack.com
        user_count: 150
        user_setup_url: https://slack.com/get-started
        vendor_certificates:
          - soc2_t2
          - iso_27001
      properties:
        admin_user_ids:
          description: User IDs of the application's admins
          items:
            format: uuid
            type: string
          type: array
        auth_method:
          description: Authentication method used to sign in
          enum:
            - google
            - microsoft
            - okta
            - sso_provider
            - credentials
            - other
          nullable: true
          type: string
        data_location:
          description: Where the vendor stores data
          nullable: true
          type: string
        description:
          description: Description
          nullable: true
          type: string
        id:
          description: Application ID
          format: uuid
          type: string
        inserted_at:
          description: Creation timestamp
          format: date-time
          type: string
        last_vendor_review_at:
          description: Date of the last vendor security review
          format: date
          nullable: true
          type: string
        mfa_activated:
          description: Whether MFA is activated for this application
          nullable: true
          type: boolean
        notes:
          description: Internal notes
          nullable: true
          type: string
        owner_user_id:
          description: Owner user ID
          format: uuid
          nullable: true
          type: string
        processed_data_types:
          description: Types of data this application processes
          items:
            enum:
              - customer_metadata
              - customer_pii
              - company_metadata
              - company_sensitive_data
              - employee_pii
              - employee_sensitive_data
              - ephi
            type: string
          type: array
        provisioning_type:
          description: Provisioning type
          enum:
            - application_admin
            - automatic
          type: string
        risk_level:
          description: Risk level assessment
          enum:
            - low
            - medium
            - high
          nullable: true
          type: string
        status:
          description: Application status
          enum:
            - ignored
            - discovered
            - approved
            - requestable
          type: string
        tags:
          description: Tags assigned to this application
          items:
            properties:
              id:
                format: uuid
                type: string
              title:
                type: string
            type: object
          type: array
        title:
          description: Application title
          type: string
        updated_at:
          description: Last update timestamp
          format: date-time
          type: string
        url:
          description: Application URL
          nullable: true
          type: string
        user_count:
          description: Number of users with access
          nullable: true
          type: integer
        user_setup_url:
          description: URL where existing users are shown and new users are invited
          nullable: true
          type: string
        vendor_certificates:
          description: Security/compliance certifications held by the vendor
          items:
            enum:
              - iso_22301
              - iso_27001
              - iso_27017
              - iso_27701
              - iso_31000
              - iso_42001
              - soc1
              - soc2_t1
              - soc2_t2
              - soc3
              - pci_dss
              - nist_csf
              - fed_ramp
              - hipaa
              - hitrust_csf
              - gdpr
              - csa_star
              - fsd_safe
            type: string
          type: array
      required:
        - id
        - title
        - status
      title: Application
      type: object
    Error:
      description: Standard error response
      example:
        error: not_found
        message: Resource not found
      properties:
        error:
          description: Error code
          example: not_found
          type: string
        errors:
          additionalProperties:
            items:
              type: string
            type: array
          description: Field-specific validation errors (only for 422 responses)
          example:
            email:
              - has invalid format
            first_name:
              - can't be blank
          type: object
        message:
          description: Human-readable error message
          example: Resource not found
          type: string
      required:
        - error
        - message
      title: Error
      type: object
    ResourceInput:
      description: >-
        Resource to upsert. Omit `id` to create a new resource. To delete an
        existing one, send it with its `id` and `delete: true`.
      properties:
        delete:
          description: Set to true to soft-delete this resource. Requires `id`.
          type: boolean
        description:
          nullable: true
          type: string
        id:
          description: >-
            Resource ID. Omit to let the server generate one. Provide a
            client-generated UUID to forward-reference this resource as a
            `parent_resource_id` of another item in the same payload.
          format: uuid
          type: string
        order:
          nullable: true
          type: integer
        parent_resource_id:
          description: Optional parent resource ID for nested groups.
          format: uuid
          nullable: true
          type: string
        permissions:
          description: Permissions nested under this resource.
          items:
            $ref: '#/components/schemas/PermissionInput'
          type: array
        requestable:
          type: boolean
        title:
          type: string
      required:
        - title
      title: ResourceInput
      type: object
    PermissionInput:
      description: >-
        Permission to upsert. Omit `id` to create a new permission. To delete an
        existing one, send it with its `id` and `delete: true`.
      properties:
        delete:
          description: Set to true to soft-delete this permission. Requires `id`.
          type: boolean
        description:
          nullable: true
          type: string
        elevated:
          type: boolean
        id:
          description: Permission ID. Omit (or supply a fresh UUID) to create.
          format: uuid
          type: string
        requestable:
          type: boolean
        title:
          type: string
      required:
        - title
      title: PermissionInput
      type: object
  securitySchemes:
    bearer:
      description: >-
        Bearer token authentication. Pass your AccessOwl API token in the
        `Authorization` header as `Bearer <token>`.
      scheme: bearer
      type: http

````