@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api redirection.io
@base https://api.redirection.io/
@version 2.0.0
@auth Bearer bearer | ApiKey Authorization in header
@endpoints 24
@hint download_for_search
@toc domains(4), drafts(3), instances(3), ips(1), organization(1), projects(5), redirections(1), rules(6)

@group domains
@endpoint GET /domains
@required {projectId: str}
@optional {searchAfterId: str}
@returns(200)
@errors {403}

@endpoint POST /domains
@required {domain: str, project: str(iri-reference)}
@optional {backendAddress: str, backendAllowInvalidCertificate: bool=true, backendEnabled: bool=false, backendUseSsl: bool=true, sslAutomatic: bool=true, sslEnabled: bool=true}
@returns(201) {backendAddress: str?, backendAllowInvalidCertificate: bool, backendEnabled: bool, backendUseSsl: bool, dnsValid: bool, domain: str, id: str, records: [map], sslAutomatic: bool, sslEnabled: bool}
@errors {400, 403, 422}

@endpoint DELETE /domains/{id}
@required {id: str}
@returns(204)
@errors {403, 404}

@endpoint GET /domains/{id}
@required {id: str}
@returns(200) {backendAddress: str?, backendAllowInvalidCertificate: bool, backendEnabled: bool, backendUseSsl: bool, dnsValid: bool, domain: str, id: str, records: [map], sslAutomatic: bool, sslEnabled: bool}
@errors {403, 404}

@endgroup

@group drafts
@endpoint GET /drafts
@required {projectId: str}
@optional {searchAfterId: str, tags: [str], enabled: bool, triggerUrl: str}
@returns(200)

@endpoint DELETE /drafts/{id}
@required {id: str}
@returns(204)
@errors {403, 404}

@endpoint GET /drafts/{id}
@required {id: str}
@returns(200) {id: str, rule: map{actions: [map], description: str?, enabled: bool, examples: [map], id: str, lastUsedAt: str(date-time)?, markers: [map], metadata: map, priority: int, tags: [str], trigger: map{date: [map], datetime: [map], excludeMethods: bool, excludeResponseStatusCodes: bool, ipAddress: any, methods: [str], requestHeaders: [map], responseStatusCodes: [int], sampling: int?, source: str, time: [map]}, usageCount: int, variables: [map]}, status: str}
@errors {403, 404}

@endgroup

@group instances
@endpoint GET /instances
@required {projectId: str}
@optional {name: str, searchAfterId: str}
@returns(200)
@errors {403}

@endpoint DELETE /instances/{id}
@required {id: str}
@returns(204)
@errors {403, 404}

@endpoint GET /instances/{id}
@required {id: str}
@returns(200) {agentVersion: str, agentVersionStatus: str, createdAt: str(date-time), id: str, logging: bool?, logsLastFlushedAt: str(date-time)?, misconfigured: bool, name: str, rulesCount: int, rulesLastUpdatedAt: str(date-time)?}
@errors {403, 404}

@endgroup

@group ips
@endpoint GET /ips
@returns(200)

@endgroup

@group organization
@endpoint GET /organization
@returns(200) {id: str, name: str, projects: [map], slug: str}

@endgroup

@group projects
@endpoint GET /projects
@returns(200)

@endpoint POST /projects
@required {name: str}
@optional {metadata: map}
@returns(201) {id: str, metadata: map, name: str, plan: str, slug: str}
@errors {400, 422}

@endpoint DELETE /projects/{id}
@required {id: str}
@returns(204)
@errors {403, 404}

@endpoint GET /projects/{id}
@required {id: str}
@returns(200) {id: str, metadata: map, name: str, plan: str, slug: str}
@errors {403, 404}

@endpoint POST /projects/{id}/publish
@required {id: str}
@returns(204)
@errors {400, 403}

@endgroup

@group redirections
@endpoint POST /redirections
@required {project: str(iri-reference), source: str, statusCode: int(301/302/307/308), target: str}
@optional {description: str, enabled: bool=true, priority: int=0, tags: [str]}
@returns(201) {id: str, rule: map{actions: [map], description: str?, enabled: bool, examples: [map], id: str, lastUsedAt: str(date-time)?, markers: [map], metadata: map, priority: int, tags: [str], trigger: map{date: [map], datetime: [map], excludeMethods: bool, excludeResponseStatusCodes: bool, ipAddress: any, methods: [str], requestHeaders: [map], responseStatusCodes: [int], sampling: int?, source: str, time: [map]}, usageCount: int, variables: [map]}, status: str}
@errors {400, 403, 422}

@endgroup

@group rules
@endpoint GET /rules
@required {projectId: str}
@optional {searchAfterId: str, tags: [str], enabled: bool, triggerUrl: str}
@returns(200)
@errors {403}

@endpoint POST /rules
@required {project: str(iri-reference), trigger: map{date: [map], datetime: [map], excludeMethods: bool, excludeResponseStatusCodes: bool, ipAddress: any, methods: [str], requestHeaders: [map], responseStatusCodes: [int], sampling: int, source!: str, time: [map]}}
@optional {actions: [map{}], description: str, enabled: bool=true, examples: [map{datetime: str(date-time), headers: [map], ipAddress: str, method: str, mustMatch!: bool, responseStatusCode: int, url!: str}], markers: [map{}], metadata: map, priority: int=0, tags: [str], variables: [map{}]}
@returns(201) {id: str, rule: map{actions: [map], description: str?, enabled: bool, examples: [map], id: str, lastUsedAt: str(date-time)?, markers: [map], metadata: map, priority: int, tags: [str], trigger: map{date: [map], datetime: [map], excludeMethods: bool, excludeResponseStatusCodes: bool, ipAddress: any, methods: [str], requestHeaders: [map], responseStatusCodes: [int], sampling: int?, source: str, time: [map]}, usageCount: int, variables: [map]}, status: str}
@errors {400, 403, 422}

@endpoint DELETE /rules/{id}
@required {id: str}
@returns(200) {id: str, rule: map{actions: [map], description: str?, enabled: bool, examples: [map], id: str, lastUsedAt: str(date-time)?, markers: [map], metadata: map, priority: int, tags: [str], trigger: map{date: [map], datetime: [map], excludeMethods: bool, excludeResponseStatusCodes: bool, ipAddress: any, methods: [str], requestHeaders: [map], responseStatusCodes: [int], sampling: int?, source: str, time: [map]}, usageCount: int, variables: [map]}, status: str}
@errors {403, 404}

@endpoint GET /rules/{id}
@required {id: str}
@returns(200) {actions: [map], description: str?, enabled: bool, examples: [map], id: str, lastUsedAt: str(date-time)?, markers: [map], metadata: map, priority: int, tags: [str], trigger: map{date: [map], datetime: [map], excludeMethods: bool, excludeResponseStatusCodes: bool, ipAddress: any, methods: [str], requestHeaders: [map], responseStatusCodes: [int], sampling: int?, source: str, time: [map]}, usageCount: int, variables: [map]}
@errors {403, 404}

@endpoint PUT /rules/{id}
@required {id: str, project: str(iri-reference), trigger: map{date: [map], datetime: [map], excludeMethods: bool, excludeResponseStatusCodes: bool, ipAddress: any, methods: [str], requestHeaders: [map], responseStatusCodes: [int], sampling: int, source!: str, time: [map]}}
@optional {actions: [map{}], description: str, enabled: bool=true, examples: [map{datetime: str(date-time), headers: [map], ipAddress: str, method: str, mustMatch!: bool, responseStatusCode: int, url!: str}], markers: [map{}], metadata: map, priority: int=0, tags: [str], variables: [map{}]}
@returns(200) {id: str, rule: map{actions: [map], description: str?, enabled: bool, examples: [map], id: str, lastUsedAt: str(date-time)?, markers: [map], metadata: map, priority: int, tags: [str], trigger: map{date: [map], datetime: [map], excludeMethods: bool, excludeResponseStatusCodes: bool, ipAddress: any, methods: [str], requestHeaders: [map], responseStatusCodes: [int], sampling: int?, source: str, time: [map]}, usageCount: int, variables: [map]}, status: str}
@errors {400, 403, 404, 422}

@endpoint GET /rules/{id}/statistics
@required {id: str, projectId: str}
@optional {start: str, end: str}
@returns(200)
@errors {403}

@endgroup

@end
