openapi: 3.0.0 info: title: Auth API description: > # Introduction This API allows you to manage API keys. API keys are the fundamental building block of CARTO's authorization system. See this this guide for more information. This API accepts and returns JSON. API base endpoint is `https://.carto.com/api/v3/api_keys` or `https://.carto.com/u/- Creates a `regular` API key. `master` and `default_public` API Keys are automatically generated on user's creation. tags: - API Keys operationId: createApiKey requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ApiKeyCreation' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/ApiKey' '401': $ref: '#/components/responses/Unauthorized' '422': $ref: '#/components/responses/BadInput' security: - ApiKeyHTTPBasicAuth: [] - ApiKeyQueryParam: [] '/api_keys/{name}': parameters: - $ref: '#/components/parameters/apiKeyName' get: summary: Get API key description: >- Returns an API key based on its `name`. tags: - API Keys operationId: getApiKeyById responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/ApiKey' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' security: - ApiKeyHTTPBasicAuth: [] - ApiKeyQueryParam: [] delete: summary: Delete API key description: >- Deletes an API key based on it's `name`. Only `regular` API keys can be deleted. tags: - API Keys operationId: deleteApiKeyById responses: '200': description: The resource was deleted successfully. '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' security: - ApiKeyHTTPBasicAuth: [] - ApiKeyQueryParam: [] x-code-samples: '/api_keys/{name}/token/regenerate': parameters: - $ref: '#/components/parameters/apiKeyName' post: summary: Regenerate API key token description: Regenerates the API key token. The rest of the fields remain the same. tags: - API Keys operationId: regenerateApiKeyById responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/ApiKey' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' security: - ApiKeyHTTPBasicAuth: [] - ApiKeyQueryParam: [] x-code-samples: components: schemas: ApiKeys: type: object properties: total: type: integer description: Total number of API Keys count: type: integer description: Number of returned API Keys result: type: array items: $ref: '#/components/schemas/ApiKey' _links: type: object properties: first: $ref: '#/components/schemas/Links' description: Link to the first page prev: $ref: '#/components/schemas/Links' description: Link to the previous page next: $ref: '#/components/schemas/Links' description: Link to the next page last: $ref: '#/components/schemas/Links' description: Link to the last page example: total: 3 count: 3 result: - name: Master user: username: amartin type: master token: slxIYwIDyEGGS2W9W-uEKw grants: - type: apis apis: - sql - maps - type: database tables: [] schemas: [] table_metadata: [] - type: dataservices services: - geocoding - routing - isolines - observatory created_at: '2018-02-08 14:24:41 +0000' updated_at: '2018-02-08 14:24:41 +0000' _links: self: 'https://carto.com/api/v3/api_keys/Master' - name: MyTableApi user: username: amartin type: regular token: moLv8B-kotcjUL-uxMhbGg grants: - type: apis apis: - maps - type: database tables: - schema: public name: my_table permissions: - insert - select - update schemas: - name: public permissions: - create table_metadata: [] - type: dataservices services: - geocoding - observatory created_at: '2018-02-14 13:23:12 +0000' updated_at: '2018-02-14 13:23:12 +0000' _links: self: 'https://carto.com/api/v3/api_keys/MyTableApi' - name: Default public user: username: amartin type: default token: default_public grants: - type: apis apis: - sql - maps - type: database tables: [] schemas: [] created_at: '2018-02-15 13:50:36 +0000' updated_at: '2018-02-15 13:50:36 +0000' _links: self: 'https://carto.com/api/v3/api_keys/Default%20public' _links: first: href: 'https://carto.com/api/v3/api_keys?order=updated_at&page=1&per_page=20' last: href: 'https://carto.com/api/v3/api_keys?order=updated_at&page=1&per_page=20' ApiKey: allOf: - type: object properties: name: type: string user: properties: username: type: string type: $ref: '#/components/schemas/ApiKeysTypes' token: type: string grants: type: array items: oneOf: - $ref: '#/components/schemas/ApisGrant' - $ref: '#/components/schemas/GrantDatabase' - $ref: '#/components/schemas/GrantDataservices' _links: type: object properties: self: $ref: '#/components/schemas/Links' description: Link to the resource - $ref: '#/components/schemas/Timestamps' required: - name - type - grants example: name: MyTableApi user: username: amartin type: regular token: moLv8B-kotcjUL-uxMhbGg grants: - type: apis apis: - maps - type: database tables: - schema: public name: my_table permissions: - insert - select - update schemas: - name: public permissions: - create table_metadata: [] - type: dataservices services: - geocoding - observatory created_at: '2018-02-14 13:23:12 +0000' updated_at: '2018-02-14 13:23:12 +0000' _links: self: href: 'http://amartin.carto.com/api/v3/api_keys/MyTableApi' ApiKeyCreation: type: object properties: name: type: string description: For identifying your API Key grants: type: array items: oneOf: - $ref: '#/components/schemas/GrantDatabase' - $ref: '#/components/schemas/ApisGrant' - $ref: '#/components/schemas/GrantDataservices' discriminator: propertyName: type required: - name - grants example: name: MyTableApi grants: - type: apis apis: - maps - type: database tables: - schema: public name: my_table permissions: - select - update - insert schemas: - name: public permissions: - create table_metadata: [] - type: dataservices services: - geocoding - observatory GrantDataservices: type: object properties: type: type: string enum: - dataservices services: type: array items: $ref: '#/components/schemas/Dataservices' uniqueItems: true required: - type - services Dataservices: type: string enum: - geocoding - routing - isolines - observatory GrantDatabase: type: object properties: type: type: string enum: - database tables: type: array items: $ref: '#/components/schemas/TableGrant' schemas: type: array items: $ref: '#/components/schemas/SchemaGrant' table_metadata: type: array required: - type TableGrant: type: object properties: name: type: string schema: type: string permissions: type: array items: type: string enum: - select - insert - update - delete uniqueItems: true required: - name - schema - permissions SchemaGrant: type: object properties: name: type: string permissions: type: array items: type: string enum: - create uniqueItems: true required: - name - permissions ApisGrant: type: object properties: type: type: string enum: - apis apis: type: array items: $ref: '#/components/schemas/Apis' uniqueItems: true required: - type - apis Apis: type: string enum: - sql - maps ApiKeysTypes: type: string enum: - master - default - regular Timestamps: type: object properties: createdAt: type: string format: date-time updatedAt: type: string format: date-time Links: type: object properties: href: type: string format: url description: link to the resource securitySchemes: ApiKeyHTTPBasicAuth: type: http scheme: basic ApiKeyQueryParam: type: apiKey in: header name: api_key parameters: apiKeyName: in: path name: name required: true schema: type: string description: the API key `name` responses: NotFound: description: The specified resource was not found Unauthorized: description: Unauthorized. Wrong or no authentication provided. Forbidden: description: Forbidden. The API key does not authorize this request. BadInput: description: Request's parameters error