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

# Create Access Key

> Create an access key to access Safepay's Raast APIs



## OpenAPI

````yaml post /v1/aggregators/{raast-aggregator-id}/keys
openapi: 3.1.0
info:
  title: Raast Wire
  version: 1.0.0
  description: ''
servers:
  - url: https://api.getsafepay.com/raastwire
security: []
tags:
  - name: Aggregators
  - name: Access Keys
  - name: Merchants
  - name: Raast Merchants
  - name: Payments
  - name: Refunds
  - name: QRs
  - name: Utilities
  - name: Aliases
  - name: Ledgers
  - name: Webhooks
paths:
  /v1/aggregators/{raast-aggregator-id}/keys:
    post:
      tags:
        - Access Keys
      summary: Create Access Key
      description: Create an access key to access Safepay's Raast APIs
      operationId: createAccessKey
      parameters:
        - $ref: '#/components/parameters/AggregatorIdParam'
      requestBody:
        $ref: '#/components/requestBodies/CreateAccessKey'
      responses:
        '200':
          $ref: '#/components/responses/CreateAccessKeyResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - apiKey: []
components:
  parameters:
    AggregatorIdParam:
      name: raast-aggregator-id
      in: path
      required: true
      schema:
        type: string
        example: agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e
      description: The unique identifier for the aggregator
  requestBodies:
    CreateAccessKey:
      description: Request to create a new access key
      content:
        application/json:
          schema:
            type: object
            description: Defines the attributes required to create a new access key
            properties:
              is_active:
                type: boolean
                description: >-
                  Indicates whether the newly created access key should be
                  enabled immediately
                example: true
              name:
                type: string
                description: Human-readable label that helps distinguish this access key
                example: Developer Access Key
            required:
              - is_active
              - name
          examples:
            Create AccessKey:
              value:
                is_active: true
                name: Developer Access Key
  responses:
    CreateAccessKeyResponse:
      description: This response contains details of an access key
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/StandardResponse'
              - type: object
                properties:
                  data:
                    $ref: '#/components/schemas/AccessKey'
                    description: Newly created access key resource
          examples:
            AccessKeyCreated:
              value:
                api_version: v1
                data:
                  id: ak_cf0f7821-32f5-4c66-8e86-0d5e2bb8b6b9
                  token: ak_tok_b758ad9a
                  key_id: key_live_a31b23f0
                  aggregator_id: agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e
                  is_active: true
                  name: Developer Access Key
                  secret: sk_live_GZc5k9mT0n
                  created_at: '2025-05-19T11:19:12.000Z'
                  updated_at: '2025-05-19T11:19:12.000Z'
    Unauthorized:
      description: Unauthorized
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
          examples:
            Unauthorized:
              value:
                api_version: v1
                error:
                  code: error.unauthorized_access
                  message: partner access key is required in request header
    InternalError:
      description: Internal server error response
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
          examples:
            InternalServerError:
              value:
                api_version: v1
                error:
                  code: error.internal_server_error
                  message: rpc error code Internal desc = something went wrong
  headers:
    ContentLengthHeader:
      schema:
        type: string
        example: '256'
    DateHeader:
      schema:
        type: string
        example: Sat, 12 Aug 2023 08:55:04 GMT
  schemas:
    StandardResponse:
      type: object
      description: Standard response structure for successful operations
      properties:
        api_version:
          type: string
          example: v1
          description: The current version of the API spec
        data:
          type: object
          description: Contains the response data
    AccessKey:
      type: object
      description: Access key credential used to authenticate aggregator API requests
      properties:
        id:
          type: string
          description: Internal identifier for the access key
          example: ak_da8f1c10-346a-4be8-895a-b6187a9a9662
        token:
          type: string
          description: Public token that represents the access key
          example: ak_tok_fede37a6
        key_id:
          type: string
          description: External identifier for the key exposed to clients
          example: key_live_e111f1c10
        aggregator_id:
          type: string
          description: Aggregator identifier that owns the access key
          example: agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e
        is_active:
          type: boolean
          description: Indicates whether the key can be used for authentication
          example: true
        name:
          type: string
          description: Friendly label assigned to the access key
          example: Primary Production Key
        secret:
          type: string
          description: >-
            Secret value issued for the key; only returned on creation or
            rotation
          example: sk_live_uMPN7cX2b1
        created_at:
          description: Timestamp indicating when the key was provisioned
          allOf:
            - $ref: '#/components/schemas/Timestamp'
        updated_at:
          description: Timestamp indicating the last update applied to the key
          allOf:
            - $ref: '#/components/schemas/Timestamp'
    ApiErrorEnvelope:
      type: object
      description: Error wrapper that includes the API version and error metadata
      properties:
        api_version:
          type: string
          description: Indicates the API version associated with the response
          example: v1
        error:
          description: Structured error details describing why the request failed
          allOf:
            - $ref: '#/components/schemas/ErrorResponse'
          example:
            code: error.unauthorized_access
            message: partner access key is required in request header
    Timestamp:
      type: string
      format: date-time
      description: ISO 8601 timestamp in UTC
      example: '2025-03-13T09:12:34.000Z'
    ErrorResponse:
      type: object
      description: Standard error response structure
      properties:
        code:
          type: string
          description: Error code identifying the type of error
        message:
          type: string
          description: Human-readable error message
  securitySchemes:
    apiKey:
      type: apiKey
      name: X-SFPY-AGGREGATOR-SECRET-KEY
      in: header

````